/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author frico
 */
@Entity
@Table(name = "paiPAIS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "PaiPAIS.findAll", query = "SELECT p FROM PaiPAIS p"),
    @NamedQuery(name = "PaiPAIS.findByCodigo", query = "SELECT p FROM PaiPAIS p WHERE p.codigo = :codigo"),
    @NamedQuery(name = "PaiPAIS.findByDescripcion", query = "SELECT p FROM PaiPAIS p WHERE p.descripcion = :descripcion"),
    @NamedQuery(name = "PaiPAIS.findByRegion", query = "SELECT p FROM PaiPAIS p WHERE p.region = :region")})
public class PaiPAIS implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 32)
    @Column(name = "Codigo")
    private String codigo;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "Descripcion")
    private String descripcion;
    @Size(max = 24)
    @Column(name = "Region")
    private String region;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "paiPAIS")
    private Collection<PaiPROVINCIA> paiPROVINCIACollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "pais")
    private Collection<LegLEGAJO> legLEGAJOCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nacionalidad")
    private Collection<LegLEGAJO> legLEGAJOCollection1;

    public PaiPAIS() {
    }

    public PaiPAIS(String codigo) {
        this.codigo = codigo;
    }

    public PaiPAIS(String codigo, String descripcion) {
        this.codigo = codigo;
        this.descripcion = descripcion;
    }

    public String getCodigo() {
        return codigo;
    }

    public void setCodigo(String codigo) {
        this.codigo = codigo;
    }

    public String getDescripcion() {
        return descripcion;
    }

    public void setDescripcion(String descripcion) {
        this.descripcion = descripcion;
    }

    public String getRegion() {
        return region;
    }

    public void setRegion(String region) {
        this.region = region;
    }

    @XmlTransient
    public Collection<PaiPROVINCIA> getPaiPROVINCIACollection() {
        return paiPROVINCIACollection;
    }

    public void setPaiPROVINCIACollection(Collection<PaiPROVINCIA> paiPROVINCIACollection) {
        this.paiPROVINCIACollection = paiPROVINCIACollection;
    }

    @XmlTransient
    public Collection<LegLEGAJO> getLegLEGAJOCollection() {
        return legLEGAJOCollection;
    }

    public void setLegLEGAJOCollection(Collection<LegLEGAJO> legLEGAJOCollection) {
        this.legLEGAJOCollection = legLEGAJOCollection;
    }

    @XmlTransient
    public Collection<LegLEGAJO> getLegLEGAJOCollection1() {
        return legLEGAJOCollection1;
    }

    public void setLegLEGAJOCollection1(Collection<LegLEGAJO> legLEGAJOCollection1) {
        this.legLEGAJOCollection1 = legLEGAJOCollection1;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigo != null ? codigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PaiPAIS)) {
            return false;
        }
        PaiPAIS other = (PaiPAIS) object;
        if ((this.codigo == null && other.codigo != null) || (this.codigo != null && !this.codigo.equals(other.codigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.PaiPAIS[ codigo=" + codigo + " ]";
    }
    
}
